import { httpPost, httpGet, httpDownload, httpLogin } from './index'

export function login (data) {
  data.grant_type = 'password'
  return httpLogin('/api/oauth/token', data)
}

// username password email phone
export function register (user) {
  return httpPost('/api/admin/front/register', user)
}

export function logout () {
  return httpPost('/api/admin/front/logout')
}

export function getUserInfo () {
  return httpGet('/api/auth/info')
  // return httpGet('/api/admin/front/user/info')
}

export function getCodeImage (randomId) {
  return httpDownload('/api/auth/captcha', { key: randomId }, undefined)
}
